<?php
declare (strict_types = 1);

namespace app\model;

use think\facade\Db;
use think\Model;

/**
 * @mixin \think\Model
 */
class Origanziation extends Model
{

    /**
     * 获取学生分页
     */
    public static function pageList($data,$domain='') {
        $page = $data['page'];
        $size = $data['size'];
        $oname = isset($data['kw']) ? $data['kw'] : '';
        $size = $size + 0;
        $start = ($page -1) * $size;
        $oname = trim($oname);
        $select = Origanziation::limit($start,$size);
        if($oname != '') {
            $select = $select->where('oname','like',$oname.'%');
            $total = self::where('oname','like',$oname.'%')->count();
        } else {
            $total = self::count();
        }
        $list = $select->select()->toArray();
        if($domain != '') {
            foreach ($list as &$origan) {
                $origan['img'] = $domain.$origan['img'];
            }
        }
        return compact('list','total');
    }



}
